package projectmanagement.web;

import org.springframework.web.servlet.mvc.Controller;
import org.springframework.web.servlet.ModelAndView;

import projectmanagement.util.ApplicationSecurityManager;
import projectmanager.model.dao.PersonDao;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

public class PersonListController implements Controller {

	private PersonDao personManager;
	private ApplicationSecurityManager applicationSecurityManager;

	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		ModelAndView modelAndView = new ModelAndView("personList");

		modelAndView
				.addObject("personList", this.personManager.getPersonList());

		return modelAndView;
	}

	public PersonDao getPersonManager() {
		return personManager;
	}

	public void setPersonManager(PersonDao personManager) {
		this.personManager = personManager;
	}

	public ApplicationSecurityManager getApplicationSecurityManager() {
		return applicationSecurityManager;
	}

	public void setApplicationSecurityManager(
			ApplicationSecurityManager applicationSecurityManager) {
		this.applicationSecurityManager = applicationSecurityManager;
	}

}